using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.Common;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Security;
using System.Security.Permissions;
using System.Transactions;
using System.Xml;
using Oracle.ManagedDataAccess.Types;
using OracleInternal.Common;
using OracleInternal.ConnectionPool;
using OracleInternal.MTS;
using OracleInternal.Network;
using OracleInternal.ServiceObjects;
using OracleInternal.Sharding;

namespace Oracle.ManagedDataAccess.Client
{
	[DefaultEvent("InfoMessage")]
	[SecurityPermission(SecurityAction.Assert, ControlThread = true)]
	public sealed class OracleConnection : DbConnection, ICloneable
	{
		public enum OracleDRCPPurity
		{
			New = 1,
			Pooled
		}

		private const string METADATA_COLLECTION = "METADATACOLLECTIONS";

		private const string DATA_TYPES = "DATATYPES";

		private const string RESTRICTIONS = "RESTRICTIONS";

		private const string RESERVED_WORDS = "RESERVEDWORDS";

		private const string DATA_SOURCE_INFORMATION = "DATASOURCEINFORMATION";

		private const string ORCL_COMMAND = "ORACLECOMMAND";

		private const string DATA_TABLE = "DATATABLE";

		internal static string s_getLTXIDstatus = "declare n1 number; n2 number; committed boolean; userCallCompleted boolean; begin committed := FALSE; userCallCompleted := FALSE;sys.dbms_app_cont.get_ltxid_outcome(:1, committed, userCallCompleted); if committed then n1:=1; else n1:=0; end if; if userCallCompleted then n2:=1; else n2:=0; end if; :2 := n1; :3 := n2; end; ";

		internal static bool m_bAtLeastOneConOpen = false;

		private static object s_syncObj = new object();

		private static string s_TnsAdminOld = string.Empty;

		internal int m_config_values;

		internal string m_TNS_ADMIN;

		internal string m_Wallet_Location;

		internal ConnectionString m_cs;

		internal string m_originalConnectionString;

		internal OracleConnectionImpl m_oracleConnectionImpl;

		internal ConnectionState m_connectionState;

		internal OracleTransaction m_oraTransaction;

		internal string m_serverVersion;

		internal OracleLogicalTransaction m_logicalTransaction;

		internal bool m_bE2EMetricsChangedByClient;

		internal ConnectionString pmCS;

		internal bool m_bKeepAlive;

		internal int m_keepAliveTime = 60;

		internal int m_keepAliveInterval = 6;

		internal string m_chunkMigrationConTimeout = ConfigBaseClass.m_chunkMigrationTimeout;

		internal string m_shardingChunk;

		internal string[] m_shardingInstances;

		internal InstanceInfo[] m_shardingInstanceInfos;

		internal bool m_bIsTnsAdminSet;

		internal bool m_bIsWalletLocationSet;

		internal bool bIgnoreLogicalTransaction;

		internal bool bConnectionforTxnStatus;

		private DataSet m_metaDataCollectionDS;

		private bool m_pwdValidated;

		private bool m_disposed;

		internal SecureString m_securePassword;

		internal SecureString m_secureProxyPassword;

		internal SecureString m_secureNewPassword;

		internal OracleCredential m_orclCredential;

		internal bool m_isDb10gR2OrHigher;

		internal bool m_isDb11gR1OrHigher;

		internal bool m_isDb12cR1OrHigher;

		internal StateChangeEventHandler m_stateChangeEventHandler;

		internal static OracleHAEventHandler m_haEventHandler;

		private OracleInfoMessageEventHandler m_infoMessageEventHandler;

		internal OracleConnectionOpenEventHandler m_conOpenEventHandler;

		private int m_statementCacheSizeSnapshot;

		private int m_connectionTimeout = 15;

		private string m_dataSource = string.Empty;

		private int m_implId;

		private int m_sessionId;

		private string m_id;

		internal string m_pdbName = string.Empty;

		internal string m_serviceName = string.Empty;

		private string m_appEdition = string.Empty;

		internal string m_userProvidedConEditionName = string.Empty;

		internal string m_drcpConnectionClass;

		internal string m_drcpTagName;

		internal OracleDRCPPurity m_drcpPurity = OracleDRCPPurity.Pooled;

		internal bool m_isPuritySet;

		internal static bool m_enableDRCP = false;

		internal bool m_bDRCPUseMultitag;

		internal string m_drcpPLSQLCallback;

		internal string m_criteriaConnCls;

		internal string m_criteriaPdbName;

		internal string m_criteriaServiceName;

		internal string m_criteriaEdition;

		internal string m_criteriaTag;

		internal bool m_bCriteriaMatchAnyTag;

		internal byte m_bCriteriaDrcpPurityNew;

		internal int m_criteriaDrcpEnabled = -1;

		internal uint[] m_criteriaIds = new uint[3];

		internal bool m_bBestMatchPRHasAllMustCrit;

		internal bool m_bBestMatchingPRHasReqTag;

		internal bool m_bfoundPRMatchingAllCrit;

		internal bool m_bNewConCreated;

		internal bool m_bCriteriaPrelimAuthSession;

		internal bool m_serviceSwitchRequested;

		internal bool m_fromMTS;

		private static string m_sProviderVersion = null;

		internal OracleShardingKey m_shardKey;

		internal OracleShardingKey m_shardGroupKey;

		internal string m_ShardingKeyB64;

		internal string m_SuperShardingKeyB64;

		internal string SessionId => m_oracleConnectionImpl.m_endUserSessionId + ":" + m_oracleConnectionImpl.m_endUserSerialNum;

		internal string InstanceBranch => $"((sessid={m_oracleConnectionImpl.m_endUserSessionId}:{m_oracleConnectionImpl.m_endUserSerialNum})(inst={m_oracleConnectionImpl.m_instanceName})(br={m_oracleConnectionImpl.m_mtsTxnCtx.m_mtsTxnBranch.BranchNumber})(rmid={m_oracleConnectionImpl.m_txnCtx.m_mtsTxnRM.GetHashCode()})(branchid={m_oracleConnectionImpl.m_mtsTxnCtx.m_mtsTxnBranch.GetHashCode()})";

		internal string TnsAdminInternal
		{
			get
			{
				if (m_TNS_ADMIN == null && m_cs != null)
				{
					return m_cs.m_tnsAdmin;
				}
				return m_TNS_ADMIN;
			}
		}

		internal string WalletLocationInternal
		{
			get
			{
				if (m_Wallet_Location == null && m_cs != null)
				{
					return m_cs.m_walletLocation;
				}
				return m_Wallet_Location;
			}
		}

		[DefaultValue(null)]
		[Category("Data")]
		[Description("")]
		public string TnsAdmin
		{
			get
			{
				if (!m_bIsTnsAdminSet)
				{
					return null;
				}
				return TnsAdminInternal;
			}
			set
			{
				if (m_connectionState == ConnectionState.Open)
				{
					throw new InvalidOperationException(OracleStringResourceManager.GetErrorMesg(-7502, "TnsAdmin"));
				}
				m_TNS_ADMIN = value;
				if (m_TNS_ADMIN != null)
				{
					m_bIsTnsAdminSet = true;
				}
				if (m_cs != null)
				{
					ConnectionString cs = m_cs;
					m_cs = OracleInternal.ConnectionPool.ConnectionString.GetCS(this, ConnectionString, m_orclCredential, bCreateIfNotinCache: true);
					m_cs.m_securedPassword = cs.m_securedPassword;
					m_cs.m_securedProxyPassword = cs.m_securedProxyPassword;
					m_cs.m_bPasswordSet = cs.m_bPasswordSet;
					m_cs.m_bProxyPasswordSet = cs.m_bProxyPasswordSet;
				}
			}
		}

		[Category("Data")]
		[DefaultValue(null)]
		[Description("")]
		public string WalletLocation
		{
			get
			{
				if (!m_bIsWalletLocationSet)
				{
					return null;
				}
				return WalletLocationInternal;
			}
			set
			{
				if (m_connectionState == ConnectionState.Open)
				{
					throw new InvalidOperationException(OracleStringResourceManager.GetErrorMesg(-7502, "WalletLocation"));
				}
				m_Wallet_Location = value;
				if (m_Wallet_Location != null)
				{
					m_bIsWalletLocationSet = true;
				}
				if (m_cs != null)
				{
					ConnectionString cs = m_cs;
					m_cs = OracleInternal.ConnectionPool.ConnectionString.GetCS(this, ConnectionString, m_orclCredential, bCreateIfNotinCache: true);
					m_cs.m_securedPassword = cs.m_securedPassword;
					m_cs.m_securedProxyPassword = cs.m_securedProxyPassword;
					m_cs.m_bPasswordSet = cs.m_bPasswordSet;
					m_cs.m_bProxyPasswordSet = cs.m_bProxyPasswordSet;
				}
			}
		}

		[Description("")]
		[DefaultValue(false)]
		[Category("Data")]
		public bool KeepAlive
		{
			get
			{
				return m_bKeepAlive;
			}
			set
			{
				if (m_connectionState == ConnectionState.Open)
				{
					throw new InvalidOperationException(OracleStringResourceManager.GetErrorMesg(-7502, "KeepAlive"));
				}
				m_bKeepAlive = value;
			}
		}

		[DefaultValue(60)]
		[Description("")]
		[Category("Data")]
		public int KeepAliveTime
		{
			get
			{
				return m_keepAliveTime;
			}
			set
			{
				if (m_connectionState == ConnectionState.Open)
				{
					throw new InvalidOperationException(OracleStringResourceManager.GetErrorMesg(-7502, "KeepAliveTime"));
				}
				m_keepAliveTime = value;
			}
		}

		[Category("Data")]
		[DefaultValue(6)]
		[Description("")]
		public int KeepAliveInterval
		{
			get
			{
				return m_keepAliveInterval;
			}
			set
			{
				if (m_connectionState == ConnectionState.Open)
				{
					throw new InvalidOperationException(OracleStringResourceManager.GetErrorMesg(-7502, "KeepAliveInterval"));
				}
				m_keepAliveInterval = value;
			}
		}

		public string ChunkMigrationConnectionTimeout
		{
			get
			{
				return m_chunkMigrationConTimeout;
			}
			set
			{
				m_chunkMigrationConTimeout = value;
			}
		}

		[Editor("Oracle.VsDevTools.OracleVSGConnStringEditor, Oracle.VsDevTools, Version=4.122.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=X86", "System.Drawing.Design.UITypeEditor")]
		[DefaultValue("")]
		[Category("Data")]
		[Description("")]
		public override string ConnectionString
		{
			get
			{
				if (!m_pwdValidated || (m_cs != null && m_cs.m_persistSecurityInfo))
				{
					if (m_originalConnectionString == null)
					{
						return string.Empty;
					}
					return m_originalConnectionString;
				}
				if (m_cs == null || m_cs.m_passwordlessConString == null)
				{
					return string.Empty;
				}
				return m_cs.m_passwordlessConString;
			}
			set
			{
				if (m_connectionState == ConnectionState.Open)
				{
					throw new InvalidOperationException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.CON_STR_NOT_UPDATABLE));
				}
				string originalConnectionString = m_originalConnectionString;
				ConnectionString cs = m_cs;
				if (value != null)
				{
					m_originalConnectionString = value;
				}
				else
				{
					m_originalConnectionString = string.Empty;
				}
				try
				{
					if (!string.IsNullOrEmpty(value))
					{
						m_cs = OracleInternal.ConnectionPool.ConnectionString.GetCS(this, m_originalConnectionString, m_orclCredential, bCreateIfNotinCache: true);
					}
					else
					{
						m_cs = null;
					}
					InitializeOrclPermission(m_originalConnectionString);
				}
				catch
				{
					m_originalConnectionString = originalConnectionString;
					m_cs = cs;
					throw;
				}
				if (m_orclCredential != null && m_cs != null)
				{
					if (m_cs.m_bUserIdSet || m_cs.m_bProxyUserIdSet || m_cs.m_bPasswordSet || m_cs.m_bProxyPasswordSet || m_cs.m_bDBAPrivilegeSet)
					{
						throw new InvalidOperationException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.CON_STR_ATTRIBS_NOT_ALLOWED));
					}
					m_securePassword = null;
					m_secureProxyPassword = null;
				}
				else if (m_cs != null)
				{
					m_securePassword = null;
					m_secureProxyPassword = null;
				}
				if (m_cs != null)
				{
					OracleInternal.ConnectionPool.ConnectionString.m_conStringPool.Put(m_cs);
					m_connectionTimeout = m_cs.m_connectionTimeout;
					m_dataSource = m_cs.m_dataSource;
					m_statementCacheSizeSnapshot = m_cs.m_stmtCacheSize;
				}
				m_pwdValidated = false;
				pmCS = null;
			}
		}

		[DefaultValue(ConnectionState.Closed)]
		[Browsable(false)]
		[Description("")]
		public override ConnectionState State
		{
			get
			{
				if (m_connectionState == ConnectionState.Open && (!m_oracleConnectionImpl.IsConnectionAlive() || m_oracleConnectionImpl.m_deletionRequestor == DeletionRequestor.HA || !m_oracleConnectionImpl.m_oracleCommunication.TransportAlive))
				{
					Close();
				}
				return m_connectionState;
			}
		}

		[Category("Data")]
		[DefaultValue("")]
		[Description("")]
		public string ModuleName
		{
			set
			{
				if (m_connectionState == ConnectionState.Closed)
				{
					throw new InvalidOperationException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.CON_CLOSED));
				}
				if (value != m_oracleConnectionImpl.m_endToEndMetrics[1])
				{
					m_bE2EMetricsChangedByClient = true;
					m_oracleConnectionImpl.m_endToEndMetrics[1] = value;
					m_oracleConnectionImpl.m_endToEndMetricsModified[1] = true;
					m_oracleConnectionImpl.m_endToEndMetricsModified[2] = true;
				}
			}
		}

		[DefaultValue("")]
		[Category("Data")]
		[Description("")]
		public string ActionName
		{
			set
			{
				if (m_connectionState == ConnectionState.Closed)
				{
					throw new InvalidOperationException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.CON_CLOSED));
				}
				if (value != m_oracleConnectionImpl.m_endToEndMetrics[2])
				{
					m_bE2EMetricsChangedByClient = true;
					m_oracleConnectionImpl.m_endToEndMetrics[2] = value;
					m_oracleConnectionImpl.m_endToEndMetricsModified[2] = true;
				}
			}
		}

		[Description("")]
		[DefaultValue("")]
		[Category("Data")]
		public string ClientId
		{
			set
			{
				if (m_connectionState == ConnectionState.Closed)
				{
					throw new InvalidOperationException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.CON_CLOSED));
				}
				if (value != m_oracleConnectionImpl.m_endToEndMetrics[0])
				{
					m_bE2EMetricsChangedByClient = true;
					m_oracleConnectionImpl.m_endToEndMetrics[0] = value;
					m_oracleConnectionImpl.m_endToEndMetricsModified[0] = true;
				}
			}
		}

		[DefaultValue("")]
		[Category("Data")]
		[Description("")]
		public string ClientInfo
		{
			set
			{
				if (m_connectionState == ConnectionState.Closed)
				{
					throw new InvalidOperationException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.CON_CLOSED));
				}
				if (value != m_oracleConnectionImpl.m_endToEndMetrics[3])
				{
					m_bE2EMetricsChangedByClient = true;
					m_oracleConnectionImpl.m_endToEndMetrics[3] = value;
					m_oracleConnectionImpl.m_endToEndMetricsModified[3] = true;
				}
			}
		}

		[Browsable(false)]
		[DefaultValue(15)]
		[Description("")]
		public override int ConnectionTimeout => m_connectionTimeout;

		public override string Database => string.Empty;

		[DefaultValue("")]
		[Description("")]
		[Category("Data")]
		public string DatabaseName
		{
			get
			{
				if (m_oracleConnectionImpl != null && m_connectionState == ConnectionState.Open)
				{
					return m_oracleConnectionImpl.m_databaseName;
				}
				return string.Empty;
			}
		}

		[Description("")]
		[DefaultValue("")]
		[Category("Data")]
		public string DatabaseDomainName
		{
			get
			{
				string text = string.Empty;
				if (m_oracleConnectionImpl != null && m_connectionState == ConnectionState.Open)
				{
					text = m_oracleConnectionImpl.m_databaseDomainName;
				}
				if (!string.IsNullOrEmpty(text))
				{
					return text;
				}
				return null;
			}
		}

		[Category("Data")]
		[DefaultValue("")]
		[Description("")]
		public string HostName
		{
			get
			{
				if (m_oracleConnectionImpl != null && m_connectionState == ConnectionState.Open)
				{
					return m_oracleConnectionImpl.m_hostName;
				}
				return string.Empty;
			}
		}

		[Category("Data")]
		[DefaultValue("")]
		[Description("")]
		public string InstanceName
		{
			get
			{
				if (m_oracleConnectionImpl != null && m_connectionState == ConnectionState.Open)
				{
					return m_oracleConnectionImpl.m_instanceName;
				}
				return string.Empty;
			}
		}

		[DefaultValue("")]
		[Category("Data")]
		[Description("")]
		public string ServiceName
		{
			get
			{
				if (m_oracleConnectionImpl != null && State == ConnectionState.Open)
				{
					return m_oracleConnectionImpl.ServiceName;
				}
				return m_serviceName;
			}
			set
			{
				if (m_connectionState == ConnectionState.Open)
				{
					throw new InvalidOperationException(OracleStringResourceManager.GetErrorMesg(-7502, "ServiceName"));
				}
				if (!string.IsNullOrEmpty(value))
				{
					m_serviceName = HelperClass.RemoveSingleAndDoubleQuotes(value.ToLowerInvariant()).Trim();
				}
			}
		}

		[Category("Data")]
		[DefaultValue(null)]
		[Description("")]
		public string DatabaseEditionName
		{
			get
			{
				if (m_oracleConnectionImpl != null && State == ConnectionState.Open)
				{
					string text = m_oracleConnectionImpl.EditionName;
					if (string.IsNullOrEmpty(text))
					{
						text = m_oracleConnectionImpl.GetDefaultEditionName();
					}
					return text;
				}
				string result = null;
				if (!string.IsNullOrEmpty(m_userProvidedConEditionName))
				{
					if (m_userProvidedConEditionName[0] == '"')
					{
						int num = m_userProvidedConEditionName.IndexOf('"', 1);
						result = m_userProvidedConEditionName.Substring(1, num - 1);
					}
					else
					{
						result = m_userProvidedConEditionName.ToUpper();
					}
				}
				return result;
			}
			set
			{
				if (m_connectionState == ConnectionState.Open)
				{
					throw new InvalidOperationException(OracleStringResourceManager.GetErrorMesg(-7502, "DatabaseEditionName"));
				}
				if (!string.IsNullOrEmpty(value))
				{
					m_userProvidedConEditionName = value;
				}
			}
		}

		[Description("")]
		[DefaultValue("")]
		public override string DataSource
		{
			get
			{
				if (!m_disposed)
				{
					return m_dataSource;
				}
				return string.Empty;
			}
		}

		public static bool IsAvailable => false;

		[Browsable(false)]
		[Description("")]
		[DefaultValue("")]
		public override string ServerVersion
		{
			get
			{
				if (m_connectionState == ConnectionState.Open)
				{
					return m_serverVersion;
				}
				throw new InvalidOperationException();
			}
		}

		[Browsable(false)]
		[Description("")]
		[DefaultValue("")]
		public static string ProviderVersion
		{
			get
			{
				if (m_sProviderVersion == null)
				{
					m_sProviderVersion = CustomConfigFileReader.GetExecutingAssemblyVersion().ToString();
				}
				return m_sProviderVersion;
			}
		}

		[DefaultValue(0)]
		[Browsable(false)]
		[Description("")]
		public int StatementCacheSize
		{
			get
			{
				if (m_oracleConnectionImpl == null)
				{
					return m_statementCacheSizeSnapshot;
				}
				if (m_oracleConnectionImpl.m_statementCache != null)
				{
					m_statementCacheSizeSnapshot = m_oracleConnectionImpl.m_statementCache.m_maxCacheSize;
				}
				else
				{
					m_statementCacheSizeSnapshot = 0;
				}
				return m_statementCacheSizeSnapshot;
			}
		}

		internal OracleLogicalTransaction OracleLogicalTransaction
		{
			get
			{
				if (!m_isDb12cR1OrHigher)
				{
					return new OracleLogicalTransaction(this, null);
				}
				byte[] array = null;
				if (m_oracleConnectionImpl != null && m_oracleConnectionImpl.m_cs != null)
				{
					try
					{
						array = m_oracleConnectionImpl.GetLogicalTransactionId;
					}
					catch (Exception ex)
					{
						OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleConnection, OracleTraceFuncName.get_OracleLogicalTransaction, ex);
						throw;
					}
				}
				if (array != null)
				{
					if (m_logicalTransaction == null)
					{
						return new OracleLogicalTransaction(this, array);
					}
					if (m_logicalTransaction.m_ltxId.Length != array.Length)
					{
						return new OracleLogicalTransaction(this, array);
					}
					for (int i = 0; i < array.Length; i++)
					{
						if (m_logicalTransaction.m_ltxId[i] != array[i])
						{
							return new OracleLogicalTransaction(this, array);
						}
					}
					return m_logicalTransaction;
				}
				return new OracleLogicalTransaction(this, null);
			}
		}

		[Category("Behavior")]
		[DefaultValue(null)]
		[Description("")]
		public string DRCPConnectionClass
		{
			get
			{
				return m_drcpConnectionClass;
			}
			set
			{
				if (m_connectionState == ConnectionState.Open)
				{
					throw new InvalidOperationException(OracleStringResourceManager.GetErrorMesg(-7502, "DRCPConnectionClass"));
				}
				if (m_drcpConnectionClass != value)
				{
					m_drcpConnectionClass = value;
				}
				if (m_cs != null)
				{
					ConnectionString cs = m_cs;
					m_cs = OracleInternal.ConnectionPool.ConnectionString.GetCS(this, ConnectionString, m_orclCredential, bCreateIfNotinCache: true);
					m_cs.m_securedPassword = cs.m_securedPassword;
					m_cs.m_securedProxyPassword = cs.m_securedProxyPassword;
					m_cs.m_bPasswordSet = cs.m_bPasswordSet;
					m_cs.m_bProxyPasswordSet = cs.m_bProxyPasswordSet;
				}
			}
		}

		[Category("Behavior")]
		[DefaultValue(OracleDRCPPurity.Pooled)]
		[Description("")]
		public OracleDRCPPurity DRCPPurity
		{
			get
			{
				return m_drcpPurity;
			}
			set
			{
				if (m_connectionState == ConnectionState.Open)
				{
					throw new InvalidOperationException(OracleStringResourceManager.GetErrorMesg(-7502, "DRCPPurity"));
				}
				if (value != OracleDRCPPurity.New && value != OracleDRCPPurity.Pooled)
				{
					throw new ArgumentOutOfRangeException();
				}
				m_drcpPurity = value;
				m_isPuritySet = true;
			}
		}

		public OracleShardingKey ShardingKey => m_shardKey;

		public OracleShardingKey SuperShardingKey => m_shardGroupKey;

		internal string ShardingKeyB64 => m_ShardingKeyB64;

		internal string SuperShardingKeyB64 => m_SuperShardingKeyB64;

		protected override DbProviderFactory DbProviderFactory => OracleClientFactory.Instance;

		[DefaultValue("")]
		[Category("Data")]
		[Description("")]
		public string PDBName
		{
			get
			{
				if (m_oracleConnectionImpl != null && State == ConnectionState.Open)
				{
					string text = m_oracleConnectionImpl.PdbName;
					if (string.IsNullOrEmpty(text) && m_oracleConnectionImpl.m_pm != null)
					{
						if (string.IsNullOrEmpty(m_oracleConnectionImpl.m_pm.m_conStrPdbName))
						{
							m_oracleConnectionImpl.GetConStrDefaults();
						}
						text = m_oracleConnectionImpl.m_pm.m_conStrPdbName;
					}
					return text;
				}
				return m_pdbName;
			}
			set
			{
				if (m_connectionState == ConnectionState.Open)
				{
					throw new InvalidOperationException(OracleStringResourceManager.GetErrorMesg(-7502, "PDBName"));
				}
				if (!string.IsNullOrEmpty(value))
				{
					m_pdbName = HelperClass.RemoveSingleAndDoubleQuotes(value.ToLowerInvariant()).Trim();
				}
			}
		}

		[Category("Behavior")]
		[Description("")]
		[DefaultValue(false)]
		public bool SwitchedConnection
		{
			get
			{
				bool result = false;
				if (m_oracleConnectionImpl != null && State == ConnectionState.Open)
				{
					result = m_oracleConnectionImpl.bSessionSwitched;
				}
				return result;
			}
		}

		[Description("")]
		[DefaultValue(null)]
		[Category("Data")]
		[Browsable(false)]
		public OracleCredential Credential
		{
			get
			{
				if (m_orclCredential != null && !m_orclCredential.m_bInternalUse && ((m_cs != null && m_cs.m_persistSecurityInfo) || (m_cs != null && !m_cs.m_persistSecurityInfo && !m_pwdValidated)))
				{
					return m_orclCredential;
				}
				return null;
			}
			set
			{
				if (ConnectionState.Open == m_connectionState)
				{
					throw new InvalidOperationException(OracleStringResourceManager.GetErrorMesg(-7502, "Credential"));
				}
				if (m_orclCredential != null && value != null && !m_orclCredential.Equals(value))
				{
					m_pwdValidated = false;
					if (m_cs != null)
					{
						m_originalConnectionString = m_cs.m_passwordlessConString;
					}
				}
				if (m_cs != null && (m_cs.m_bUserIdSet || m_cs.m_bProxyUserIdSet || m_cs.m_bPasswordSet || m_cs.m_bProxyPasswordSet || m_cs.m_bDBAPrivilegeSet) && value != null)
				{
					throw new InvalidOperationException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.CON_STR_ATTRIBS_NOT_ALLOWED));
				}
				m_orclCredential = value;
				if (m_cs != null)
				{
					m_cs = OracleInternal.ConnectionPool.ConnectionString.GetCS(this, ConnectionString, m_orclCredential, bCreateIfNotinCache: true);
				}
			}
		}

		internal int m_majorVersion => m_oracleConnectionImpl.DatabaseMajorVersion;

		internal int m_minorVersion => m_oracleConnectionImpl.DatabaseMinorVersion;

		public static event OracleHAEventHandler HAEvent
		{
			add
			{
				m_haEventHandler = (OracleHAEventHandler)Delegate.Combine(m_haEventHandler, value);
			}
			remove
			{
				m_haEventHandler = (OracleHAEventHandler)Delegate.Remove(m_haEventHandler, value);
			}
		}

		public event OracleConnectionOpenEventHandler ConnectionOpen
		{
			add
			{
				if (m_connectionState == ConnectionState.Open)
				{
					throw new InvalidOperationException(OracleStringResourceManager.GetErrorMesg(-7502, "ConnectionOpen"));
				}
				m_conOpenEventHandler = value;
			}
			remove
			{
				m_conOpenEventHandler = (OracleConnectionOpenEventHandler)Delegate.Remove(m_conOpenEventHandler, value);
			}
		}

		public override event StateChangeEventHandler StateChange
		{
			add
			{
				m_stateChangeEventHandler = (StateChangeEventHandler)Delegate.Combine(m_stateChangeEventHandler, value);
			}
			remove
			{
				m_stateChangeEventHandler = (StateChangeEventHandler)Delegate.Remove(m_stateChangeEventHandler, value);
			}
		}

		public event OracleInfoMessageEventHandler InfoMessage
		{
			add
			{
				m_infoMessageEventHandler = (OracleInfoMessageEventHandler)Delegate.Combine(m_infoMessageEventHandler, value);
			}
			remove
			{
				m_infoMessageEventHandler = (OracleInfoMessageEventHandler)Delegate.Remove(m_infoMessageEventHandler, value);
			}
		}

		internal bool CanReturnBestMatchingPR()
		{
			if (m_bfoundPRMatchingAllCrit || m_bBestMatchPRHasAllMustCrit)
			{
				return true;
			}
			return false;
		}

		public OracleConnection()
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleConnection, OracleTraceFuncName.ctor);
			}
			m_connectionState = ConnectionState.Closed;
			m_appEdition = ConfigBaseClass.m_appEdition;
			m_drcpConnectionClass = ConfigBaseClass.m_connectionClass;
			m_criteriaIds[0] = 0u;
			m_criteriaIds[1] = 0u;
			m_criteriaIds[2] = 0u;
			m_id = GetHashCode().ToString();
			m_shardKey = null;
			m_shardGroupKey = null;
			m_ShardingKeyB64 = null;
			m_SuperShardingKeyB64 = null;
			try
			{
				TimeStamp.InitializelatestTZversion();
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleConnection, OracleTraceFuncName.ctor, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleConnection, OracleTraceFuncName.ctor);
				}
			}
		}

		public OracleConnection(string connectionString)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleConnection, OracleTraceFuncName.ctor);
			}
			m_appEdition = ConfigBaseClass.m_appEdition;
			m_drcpConnectionClass = ConfigBaseClass.m_connectionClass;
			m_criteriaIds[0] = 0u;
			m_criteriaIds[1] = 0u;
			m_criteriaIds[2] = 0u;
			m_id = GetHashCode().ToString();
			m_shardKey = null;
			m_shardGroupKey = null;
			m_ShardingKeyB64 = null;
			m_SuperShardingKeyB64 = null;
			try
			{
				m_connectionState = ConnectionState.Closed;
				ConnectionString = connectionString;
				TimeStamp.InitializelatestTZversion();
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleConnection, OracleTraceFuncName.ctor, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleConnection, OracleTraceFuncName.ctor);
				}
			}
		}

		public OracleConnection(string connectionString, OracleCredential orclCredential)
			: this(connectionString)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleConnection, OracleTraceFuncName.ctor);
			}
			try
			{
				Credential = orclCredential;
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleConnection, OracleTraceFuncName.ctor, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleConnection, OracleTraceFuncName.ctor);
				}
			}
		}

		~OracleConnection()
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleConnection, OracleTraceFuncName.dtor);
			}
			try
			{
				try
				{
					Dispose(disposing: false);
				}
				catch (Exception ex)
				{
					if (ProviderConfig.m_bTraceLevelPublic)
					{
						Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleConnection, OracleTraceFuncName.dtor, ex.Message);
					}
				}
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleConnection, OracleTraceFuncName.dtor);
				}
			}
		}

		internal static string Dump()
		{
			return OracleConnectionDispenser<OraclePoolManager, OraclePool, OracleConnectionImpl>.Dump();
		}

		internal static string Dump(string txnid)
		{
			return OracleConnectionDispenser<OraclePoolManager, OraclePool, OracleConnectionImpl>.Dump(txnid);
		}

		public override void Open()
		{
			Tracing.Start();
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleConnection, OracleTraceFuncName.Open, "(conid=" + m_id + ") (state=" + m_connectionState.ToString() + ") (sessid=" + m_sessionId + ") (implid=" + m_implId + ") (pooling=" + ((m_cs != null && m_cs.m_pooling) ? "T" : "F") + ") " + Trace.GetCPInfo(m_oracleConnectionImpl, null, null, null));
			}
			if (!m_bAtLeastOneConOpen)
			{
				lock (OracleConfiguration.s_syncObj)
				{
					if (!m_bAtLeastOneConOpen)
					{
						bool flag = false;
						m_bAtLeastOneConOpen = true;
						string tnsAdminLocation = ConfigBaseClass.m_TnsAdminLocation;
						if (OracleConfiguration.propertySetByOcfg["TnsAdmin"] != null && (bool)OracleConfiguration.propertySetByOcfg["TnsAdmin"] && !string.IsNullOrEmpty(tnsAdminLocation))
						{
							bool flag2 = false;
							bool flag3 = false;
							string filePath = ProviderConfig.getFilePath(OraFiles.TnsNames, tnsAdminLocation, "tnsnames.ora");
							if (!string.IsNullOrEmpty(filePath))
							{
								Hashtable hashtable = new Hashtable(StringComparer.OrdinalIgnoreCase);
								ProviderConfig.NewOraFileParams(OraFiles.TnsNames, filePath, hashtable);
								AddressResolution.SetNewTNSHT(hashtable);
							}
							string filePath2 = ProviderConfig.getFilePath(OraFiles.SqlNet, tnsAdminLocation, "sqlnet.ora");
							if (!string.IsNullOrEmpty(filePath2))
							{
								Hashtable configParameters = ConfigBaseClass.m_configParameters;
								Hashtable obj = (Hashtable)ConfigBaseClass.m_configParameters.Clone();
								Hashtable configParamFrSqlnetora = ConfigBaseClass.m_configParamFrSqlnetora;
								flag2 = true;
								foreach (DictionaryEntry item in obj)
								{
									if (configParamFrSqlnetora[item.Key] != null && (bool)configParamFrSqlnetora[item.Key])
									{
										configParameters.Remove(item.Key);
									}
								}
								ProviderConfig.NewOraFileParams(OraFiles.SqlNet, filePath2, configParameters);
							}
							string filePath3 = ProviderConfig.getFilePath(OraFiles.Ldap, tnsAdminLocation, "ldap.ora");
							if (flag = !string.IsNullOrEmpty(filePath3))
							{
								Hashtable lDAPCfParamFrAppConfig = ConfigBaseClass.m_LDAPCfParamFrAppConfig;
								Hashtable oracleConfigParameters = ConfigBaseClass.m_oracleConfigParameters;
								Hashtable lDAPconfigParameters = ConfigBaseClass.m_LDAPconfigParameters;
								Hashtable obj2 = (Hashtable)ConfigBaseClass.m_LDAPconfigParameters.Clone();
								flag3 = true;
								foreach (DictionaryEntry item2 in obj2)
								{
									if ((lDAPCfParamFrAppConfig[item2.Key] == null || !(bool)lDAPCfParamFrAppConfig[item2.Key]) && !oracleConfigParameters.ContainsKey(item2.Key))
									{
										lDAPconfigParameters.Remove(item2.Key);
									}
								}
								ProviderConfig.NewOraFileParams(OraFiles.Ldap, filePath3, lDAPconfigParameters);
							}
							if (flag2 || flag3)
							{
								AddressResolution.SetNewLDAP(ConfigBaseClass.m_configParameters, ConfigBaseClass.m_LDAPconfigParameters);
							}
						}
						string ldapAdminLocation = ConfigBaseClass.m_LdapAdminLocation;
						if (OracleConfiguration.propertySetByOcfg["LdapAdmin"] != null && (bool)OracleConfiguration.propertySetByOcfg["LdapAdmin"] && !flag && !string.IsNullOrEmpty(ldapAdminLocation))
						{
							string filePath4 = ProviderConfig.getFilePath(OraFiles.Ldap, ldapAdminLocation, "ldap.ora");
							if (!string.IsNullOrEmpty(filePath4))
							{
								Hashtable lDAPCfParamFrAppConfig2 = ConfigBaseClass.m_LDAPCfParamFrAppConfig;
								Hashtable oracleConfigParameters2 = ConfigBaseClass.m_oracleConfigParameters;
								Hashtable lDAPconfigParameters2 = ConfigBaseClass.m_LDAPconfigParameters;
								foreach (DictionaryEntry item3 in (Hashtable)ConfigBaseClass.m_LDAPconfigParameters.Clone())
								{
									if ((lDAPCfParamFrAppConfig2[item3.Key] == null || !(bool)lDAPCfParamFrAppConfig2[item3.Key]) && !oracleConfigParameters2.ContainsKey(item3.Key))
									{
										lDAPconfigParameters2.Remove(item3.Key);
									}
								}
								ProviderConfig.NewOraFileParams(OraFiles.Ldap, filePath4, lDAPconfigParameters2);
								AddressResolution.SetNewLDAP(null, lDAPconfigParameters2);
							}
						}
					}
				}
			}
			try
			{
				if (m_disposed)
				{
					throw new ObjectDisposedException(GetType().Name);
				}
				if (ConnectionState.Open == m_connectionState)
				{
					throw new InvalidOperationException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.CON_ALREADY_OPEN));
				}
				if (m_cs == null || !m_cs.m_bInitilialized)
				{
					throw new InvalidOperationException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.ODP_INVALID_VALUE, "OracleConnection.ConnectionString"));
				}
				if (m_cs.m_enlist == Enlist.True && Transaction.Current != null && Transaction.Current.IsolationLevel != 0 && Transaction.Current.IsolationLevel != System.Transactions.IsolationLevel.ReadCommitted)
				{
					throw new ArgumentException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.CON_INVALID_ISO_LEVEL), "isolationLevel");
				}
				if (string.IsNullOrEmpty(m_pdbName) && !string.IsNullOrEmpty(m_serviceName))
				{
					throw new InvalidOperationException(OracleStringResourceManager.GetErrorMesg(-7501, "PDBName", "ServiceName"));
				}
				m_criteriaConnCls = m_drcpConnectionClass;
				if (m_drcpPurity == OracleDRCPPurity.New)
				{
					m_bCriteriaDrcpPurityNew = 1;
				}
				if (!string.IsNullOrEmpty(m_pdbName) || !string.IsNullOrEmpty(m_serviceName) || !string.IsNullOrEmpty(m_userProvidedConEditionName) || !string.IsNullOrEmpty(m_appEdition))
				{
					if (!string.IsNullOrEmpty(m_pdbName))
					{
						m_criteriaPdbName = m_pdbName.Trim().ToLowerInvariant();
						m_serviceSwitchRequested = true;
					}
					else
					{
						m_criteriaPdbName = null;
					}
					m_criteriaServiceName = ((!string.IsNullOrEmpty(m_serviceName)) ? m_serviceName.Trim().ToLowerInvariant() : null);
					if (!string.IsNullOrEmpty(m_userProvidedConEditionName) || !string.IsNullOrEmpty(m_appEdition))
					{
						if (!string.IsNullOrEmpty(m_appEdition) && string.IsNullOrEmpty(m_userProvidedConEditionName))
						{
							m_criteriaEdition = m_appEdition.Trim();
						}
						else
						{
							m_criteriaEdition = m_userProvidedConEditionName.Trim();
						}
					}
				}
				if (m_cs.m_conPoolKey == null)
				{
					m_cs.m_conPoolKey = new ConnectionPoolId(m_cs.m_pmId, m_orclCredential);
				}
				if (m_orclCredential != null)
				{
					m_cs.m_dbaPrivilege = m_orclCredential.m_dbaPrivilege;
				}
				m_oracleConnectionImpl = OracleConnectionDispenser<OraclePoolManager, OraclePool, OracleConnectionImpl>.Get(m_cs, m_cs.m_pm, pmCS, m_securePassword, m_secureProxyPassword, this);
				CheckForWarnings(this);
				if (m_oracleConnectionImpl != null)
				{
					m_statementCacheSizeSnapshot = ((m_oracleConnectionImpl.m_statementCache != null) ? m_oracleConnectionImpl.m_statementCache.m_maxCacheSize : 0);
				}
				if (m_secureNewPassword != null)
				{
					m_cs.m_securedPassword = m_secureNewPassword;
				}
				if (!m_cs.m_bDeadObject && !m_cs.m_bPooled && m_originalConnectionString != null && m_originalConnectionString.Length > 0 && !m_cs.m_bPooled)
				{
					OracleInternal.ConnectionPool.ConnectionString.m_conStringPool.Put(m_cs);
				}
				if (m_cs.m_pm == null)
				{
					m_cs.m_pm = m_oracleConnectionImpl.m_pm;
				}
				pmCS = m_cs.m_pm.m_cs;
				m_securePassword = pmCS.m_securedPassword;
				m_secureProxyPassword = pmCS.m_securedProxyPassword;
				if (m_oracleConnectionImpl.m_pm.m_serverVersion != null)
				{
					m_serverVersion = m_oracleConnectionImpl.m_pm.m_serverVersion;
				}
				else
				{
					m_serverVersion = m_oracleConnectionImpl.GetServerVersion();
				}
				ConnectionState connectionState = m_connectionState;
				m_connectionState = ConnectionState.Open;
				m_bAtLeastOneConOpen = true;
				m_pwdValidated = true;
				if (!m_cs.m_persistSecurityInfo)
				{
					m_originalConnectionString = null;
				}
				m_isDb10gR2OrHigher = m_oracleConnectionImpl.m_isDb10gR2OrHigher;
				m_isDb11gR1OrHigher = m_oracleConnectionImpl.m_isDb11gR1OrHigher;
				m_isDb12cR1OrHigher = m_oracleConnectionImpl.m_isDb12cR1OrHigher;
				if (!m_oracleConnectionImpl.m_bSetRequestBoundaryPiggybackSent && (Enlist.True != m_cs.m_enlist || null == Transaction.Current || m_oracleConnectionImpl.m_mtsTxnCtx == null || m_oracleConnectionImpl.m_mtsTxnCtx.m_txnType == MTSTxnType.None))
				{
					m_oracleConnectionImpl.BeginRequest();
				}
				if (m_cs.m_enlist == Enlist.True && Transaction.Current != null && (m_oracleConnectionImpl.m_mtsTxnCtx == null || (m_oracleConnectionImpl.m_mtsTxnCtx != null && m_oracleConnectionImpl.m_mtsTxnCtx.m_txnType == MTSTxnType.None)))
				{
					MTSRMManager.CCPEnlistTransaction(m_oracleConnectionImpl, Transaction.Current, this);
				}
				if (m_cs.m_enlist == Enlist.True && Transaction.Current != null)
				{
					m_oracleConnectionImpl.m_lastEnlistedTransaction = Transaction.Current;
				}
				if (m_oracleConnectionImpl != null)
				{
					m_oracleConnectionImpl.AlterSessionOnConnect(this);
				}
				if (m_oracleConnectionImpl != null)
				{
					if (!m_oracleConnectionImpl.IsNewConnection)
					{
						if (m_shardingInstanceInfos != null)
						{
							InstanceInfo[] shardingInstanceInfos = m_shardingInstanceInfos;
							foreach (InstanceInfo instanceInfo in shardingInstanceInfos)
							{
								if (instanceInfo.InstanceName.Equals(m_oracleConnectionImpl.InstanceName))
								{
									m_shardingChunk = instanceInfo.ChunkName;
									break;
								}
							}
						}
						if ((m_ShardingKeyB64 != null || m_SuperShardingKeyB64 != null) && m_shardingChunk != null)
						{
							m_oracleConnectionImpl.SetShardingInfoForPiggyback(m_ShardingKeyB64, m_SuperShardingKeyB64, m_shardingChunk);
						}
					}
					else
					{
						m_oracleConnectionImpl.IsNewConnection = false;
					}
				}
				if (m_stateChangeEventHandler != null)
				{
					RaiseStateChange(connectionState, m_connectionState);
				}
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					if (m_oracleConnectionImpl.m_pxyUserSessionId == -1)
					{
						Trace.Write(OracleTraceLevel.Private, OracleTraceTag.CP, OracleTraceClassName.OracleConnection, OracleTraceFuncName.Open, "(GET) (ENDSID=" + m_oracleConnectionImpl.m_endUserSessionId + ":" + m_oracleConnectionImpl.m_endUserSerialNum + ")");
					}
					else
					{
						Trace.Write(OracleTraceLevel.Private, OracleTraceTag.CP, OracleTraceClassName.OracleConnection, OracleTraceFuncName.Open, "(GET) (ENDSID=" + m_oracleConnectionImpl.m_endUserSessionId + ":" + m_oracleConnectionImpl.m_endUserSerialNum + ")(PXYSID=" + m_oracleConnectionImpl.m_pxyUserSessionId + ":" + m_oracleConnectionImpl.m_pxyUserSerialNum + ")");
					}
				}
				if (m_oracleConnectionImpl != null)
				{
					m_implId = m_oracleConnectionImpl.GetHashCode();
					m_sessionId = m_oracleConnectionImpl.m_endUserSessionId;
					m_oracleConnectionImpl.m_bCanUseSecureCQN = m_majorVersion >= 21 && OracleConfiguration.UseClientInitiatedCQN;
				}
				OracleConnectionOpenEventArgs eventArgs = new OracleConnectionOpenEventArgs(this);
				OnConnectionOpen(eventArgs);
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleConnection, OracleTraceFuncName.Open, ex);
				throw;
			}
			finally
			{
				string[] shardingInstances = m_shardingInstances;
				m_shardingInstances = null;
				m_shardingInstanceInfos = null;
				try
				{
					m_criteriaTag = null;
				}
				catch
				{
				}
				if (m_oracleConnectionImpl != null)
				{
					m_oracleConnectionImpl.m_bCheckIfAlterSessionReqd = true;
				}
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleConnection, OracleTraceFuncName.Open, "(conid=" + m_id + ") (state=" + m_connectionState.ToString() + ") (sessid=" + m_sessionId + ") (implid=" + m_implId + ") (pooling=" + ((m_cs != null && m_cs.m_pooling) ? "T" : "F") + ") " + Trace.GetCPInfo(m_oracleConnectionImpl, null, null, null, bResourcePoolInfo: true, bDistributionInfo: true, shardingInstances));
				}
			}
		}

		public void OpenWithNewPassword(string newPassword)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleConnection, OracleTraceFuncName.OpenWithNewPassword, "(conid=" + m_id + ") (state=" + m_connectionState.ToString() + ") (sessid=" + m_sessionId + ") (implid=" + m_implId + ") (pooling=" + ((m_cs != null && m_cs.m_pooling) ? "T" : "F") + ") (txnid=" + ((m_cs != null && m_cs.m_enlist == Enlist.True && Transaction.Current != null) ? Transaction.Current.TransactionInformation.LocalIdentifier : "n/a") + ")");
			}
			try
			{
				if (m_orclCredential != null)
				{
					throw new InvalidOperationException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.INVALID_OPER_CREDENTIAL_SET));
				}
				ConnectionString cs = m_cs;
				m_cs = cs.Clone();
				m_cs.m_bPooled = false;
				SecureString secureString = new SecureString();
				for (int i = 0; i < newPassword.Length; i++)
				{
					secureString.AppendChar(newPassword[i]);
				}
				m_secureNewPassword = secureString;
				try
				{
					Open();
				}
				catch (Exception)
				{
					m_cs = cs;
					throw;
				}
				finally
				{
					m_secureNewPassword = null;
				}
				cs = null;
			}
			catch (Exception ex2)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleConnection, OracleTraceFuncName.OpenWithNewPassword, ex2);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleConnection, OracleTraceFuncName.OpenWithNewPassword, "(conid=" + m_id + ") (state=" + m_connectionState.ToString() + ") (sessid=" + m_sessionId + ") (implid=" + m_implId + ") (pooling=" + ((m_cs != null && m_cs.m_pooling) ? "T" : "F") + ") " + Trace.GetCPInfo(m_oracleConnectionImpl, null, null, null, bResourcePoolInfo: true, bDistributionInfo: true));
				}
			}
		}

		public void OpenWithNewPassword(SecureString secureNewPassword)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleConnection, OracleTraceFuncName.OpenWithNewPassword, "(conid=" + m_id + ") (state=" + m_connectionState.ToString() + ") (sessid=" + m_sessionId + ") (implid=" + m_implId + ") (pooling=" + ((m_cs != null && m_cs.m_pooling) ? "T" : "F") + ") (txnid=" + ((m_cs != null && m_cs.m_enlist == Enlist.True && Transaction.Current != null) ? Transaction.Current.TransactionInformation.LocalIdentifier : "n/a") + ")");
			}
			try
			{
				if (secureNewPassword == null)
				{
					throw new ArgumentNullException("secureNewPassword");
				}
				if (!secureNewPassword.IsReadOnly())
				{
					throw new ArgumentException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.PWD_READONLY, "secureNewPassword"));
				}
				if (m_orclCredential == null)
				{
					throw new InvalidOperationException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.INVALID_OPER_CREDENTIAL_NOT_SET));
				}
				ConnectionString cs = m_cs;
				m_cs = cs.Clone();
				m_cs.m_bPooled = false;
				m_secureNewPassword = secureNewPassword;
				try
				{
					Open();
				}
				catch (Exception)
				{
					m_cs = cs;
					throw;
				}
				cs = null;
			}
			catch (Exception ex2)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleConnection, OracleTraceFuncName.OpenWithNewPassword, ex2);
				throw;
			}
			finally
			{
				m_secureNewPassword = null;
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleConnection, OracleTraceFuncName.OpenWithNewPassword, "(conid=" + m_id + ") (state=" + m_connectionState.ToString() + ") (sessid=" + m_sessionId + ") (implid=" + m_implId + ") (pooling=" + ((m_cs != null && m_cs.m_pooling) ? "T" : "F") + ") " + Trace.GetCPInfo(m_oracleConnectionImpl, null, null, null, bResourcePoolInfo: true, bDistributionInfo: true));
				}
			}
		}

		public new OracleTransaction BeginTransaction()
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleConnection, OracleTraceFuncName.BeginTransaction);
			}
			try
			{
				m_oraTransaction = GetTransaction();
				bool flag = m_oracleConnectionImpl.m_mtsTxnCtx != null && m_oracleConnectionImpl.m_mtsTxnCtx.m_txnType != MTSTxnType.None;
				if (m_oraTransaction != null || flag)
				{
					throw new InvalidOperationException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.CON_ALREADY_TXNED));
				}
				m_oraTransaction = new OracleTransaction(this, System.Data.IsolationLevel.ReadCommitted);
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleConnection, OracleTraceFuncName.BeginTransaction, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleConnection, OracleTraceFuncName.BeginTransaction);
				}
			}
			return m_oraTransaction;
		}

		public new OracleTransaction BeginTransaction(System.Data.IsolationLevel isolationLevel)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleConnection, OracleTraceFuncName.BeginTransaction);
			}
			try
			{
				m_oraTransaction = GetTransaction();
				bool flag = m_oracleConnectionImpl.m_mtsTxnCtx != null && m_oracleConnectionImpl.m_mtsTxnCtx.m_txnType != MTSTxnType.None;
				if (m_oraTransaction != null || flag)
				{
					throw new InvalidOperationException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.CON_ALREADY_TXNED));
				}
				if (isolationLevel != System.Data.IsolationLevel.ReadCommitted && isolationLevel != System.Data.IsolationLevel.Serializable)
				{
					throw new ArgumentException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.CON_INVALID_ISO_LEVEL), "isolationLevel");
				}
				m_oraTransaction = new OracleTransaction(this, isolationLevel);
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleConnection, OracleTraceFuncName.BeginTransaction, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleConnection, OracleTraceFuncName.BeginTransaction);
				}
			}
			return m_oraTransaction;
		}

		public override void ChangeDatabase(string pdbName)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleConnection, OracleTraceFuncName.ChangeDatabase);
			}
			try
			{
				throw new NotSupportedException();
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleConnection, OracleTraceFuncName.ChangeDatabase, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleConnection, OracleTraceFuncName.ChangeDatabase);
				}
			}
		}

		private void ResetAllCriteria()
		{
			m_criteriaConnCls = null;
			m_criteriaPdbName = null;
			m_criteriaServiceName = null;
			m_criteriaEdition = null;
			m_criteriaTag = null;
			m_bCriteriaMatchAnyTag = false;
			m_bCriteriaDrcpPurityNew = 0;
			m_criteriaDrcpEnabled = -1;
			m_criteriaIds[0] = 0u;
			m_criteriaIds[1] = 0u;
			m_criteriaIds[2] = 0u;
			m_bBestMatchPRHasAllMustCrit = false;
			m_bBestMatchingPRHasReqTag = false;
			m_bfoundPRMatchingAllCrit = false;
			m_bNewConCreated = false;
			m_bCriteriaPrelimAuthSession = false;
			m_serviceSwitchRequested = false;
			m_fromMTS = false;
		}

		public override void Close()
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleConnection, OracleTraceFuncName.Close, "(conid=" + m_id + ") (state=" + m_connectionState.ToString() + ") (sessid=" + m_sessionId + ") (implid=" + m_implId + ") (pooling=" + ((m_cs != null && m_cs.m_pooling) ? "T" : "F") + ") " + Trace.GetCPInfo(m_oracleConnectionImpl, null, null, null));
			}
			try
			{
				m_sessionId = 0;
				bool flag = false;
				if (ConnectionState.Open != m_connectionState)
				{
					return;
				}
				if (m_oracleConnectionImpl != null && (m_ShardingKeyB64 != null || m_SuperShardingKeyB64 != null) && m_shardingChunk != null)
				{
					m_oracleConnectionImpl.SetShardingInfoForPiggyback(null, null, null);
				}
				bool flag2 = true;
				if (!m_oracleConnectionImpl.IsConnectionAlive())
				{
					flag2 = false;
				}
				else if (m_oracleConnectionImpl.m_cs.m_pooling && !m_oracleConnectionImpl.m_oracleCommunication.TransportAlive)
				{
					flag2 = false;
				}
				if (!flag2)
				{
					lock (m_oracleConnectionImpl)
					{
						if (ProviderConfig.m_bTraceLevelPrivate)
						{
							string str = $"({m_oracleConnectionImpl.m_endUserSessionId}:{m_oracleConnectionImpl.m_endUserSerialNum})";
							Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)2304, OracleTraceClassName.PoolManager, OracleTraceFuncName.MarkAllPRsForDeletion, str + " : (HA) Setting pr.m_deletionRequestor = DeletionRequestor.HA");
						}
						m_oracleConnectionImpl.m_deletionRequestor = DeletionRequestor.HA;
					}
				}
				else
				{
					bool num = (m_oracleConnectionImpl.m_marshallingEngine.m_endOfCallStatus & 2) != 0;
					flag = m_oracleConnectionImpl.m_mtsTxnCtx != null && m_oracleConnectionImpl.m_mtsTxnCtx.m_txnType != MTSTxnType.None;
					if (num && m_oraTransaction == null && !flag)
					{
						m_oraTransaction = new OracleTransaction(this, System.Data.IsolationLevel.ReadCommitted);
					}
					if (m_oraTransaction != null)
					{
						if (m_oraTransaction.Completed)
						{
							m_oraTransaction = null;
						}
						else
						{
							try
							{
								m_oraTransaction.Rollback();
							}
							catch
							{
								flag2 = false;
								lock (m_oracleConnectionImpl)
								{
									m_oracleConnectionImpl.m_deletionRequestor = DeletionRequestor.HA;
								}
							}
							finally
							{
								m_oraTransaction = null;
							}
						}
					}
				}
				if (m_oracleConnectionImpl != null)
				{
					m_oracleConnectionImpl.FireConnectionCloseEvent();
				}
				if (flag2 && m_oracleConnectionImpl != null)
				{
					m_oracleConnectionImpl.m_lastEnlistedTransaction = null;
					if ((m_cs.m_pooling || m_cs.m_drcpEnabled == DrcpType.True) && flag2 && m_bE2EMetricsChangedByClient)
					{
						m_oracleConnectionImpl.ResetEndToEndMetrics();
						m_bE2EMetricsChangedByClient = false;
					}
					if (m_oracleConnectionImpl.m_cs.m_pooling || m_oracleConnectionImpl.m_pm.m_cs.m_drcpEnabled == DrcpType.True)
					{
						m_oracleConnectionImpl.FlushPendingPiggybackMessages();
					}
				}
				ConnectionState connectionState = m_connectionState;
				m_connectionState = ConnectionState.Closed;
				if (m_stateChangeEventHandler != null)
				{
					RaiseStateChange(connectionState, m_connectionState);
				}
				if (m_oracleConnectionImpl != null)
				{
					m_statementCacheSizeSnapshot = ((m_oracleConnectionImpl.m_statementCache != null) ? m_oracleConnectionImpl.m_statementCache.m_maxCacheSize : 0);
					if (ProviderConfig.m_bTraceLevelPrivate)
					{
						if (m_oracleConnectionImpl.m_pxyUserSessionId == -1)
						{
							Trace.Write(OracleTraceLevel.Private, OracleTraceTag.CP, OracleTraceClassName.OracleConnection, OracleTraceFuncName.Close, "(PUT) (ENDSID=" + m_oracleConnectionImpl.m_endUserSessionId + ":" + m_oracleConnectionImpl.m_endUserSerialNum + ")");
						}
						else
						{
							Trace.Write(OracleTraceLevel.Private, OracleTraceTag.CP, OracleTraceClassName.OracleConnection, OracleTraceFuncName.Close, "(PUT) (ENDSID=" + m_oracleConnectionImpl.m_endUserSessionId + ":" + m_oracleConnectionImpl.m_endUserSerialNum + ")(PXYSID=" + m_oracleConnectionImpl.m_pxyUserSessionId + ":" + m_oracleConnectionImpl.m_pxyUserSerialNum + ")");
						}
					}
					if (!string.IsNullOrEmpty(m_oracleConnectionImpl.PdbName) && !m_oracleConnectionImpl.m_pm.m_bDefaultsFetched)
					{
						lock (m_oracleConnectionImpl.m_pm.m_conStrDefaultsLocker)
						{
							if (!m_oracleConnectionImpl.m_pm.m_bDefaultsFetched)
							{
								OracleConnectionImpl oracleConnectionImpl = new OracleConnectionImpl();
								oracleConnectionImpl.m_cs = m_oracleConnectionImpl.m_cs.Clone();
								oracleConnectionImpl.m_pm = m_oracleConnectionImpl.m_pm;
								oracleConnectionImpl.m_cs.m_pooling = false;
								oracleConnectionImpl.Connect(oracleConnectionImpl.m_cs, bOpenEndUserSession: false, null);
								oracleConnectionImpl.GetPdbNameFromDb();
								oracleConnectionImpl.DisConnect(null);
							}
						}
					}
					OracleConnectionDispenser<OraclePoolManager, OraclePool, OracleConnectionImpl>.PutFromApp(m_oracleConnectionImpl, this);
					m_oracleConnectionImpl.bSessionSwitched = false;
					m_oracleConnectionImpl = null;
				}
				if (m_metaDataCollectionDS != null)
				{
					m_metaDataCollectionDS.Clear();
					m_metaDataCollectionDS.Dispose();
					m_metaDataCollectionDS = null;
				}
			}
			catch (OracleException ex)
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleConnection, OracleTraceFuncName.Close, ex.ToString());
				}
			}
			catch (NetworkException ex2)
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleConnection, OracleTraceFuncName.Close, ex2.ToString());
				}
			}
			catch (Exception ex3)
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleConnection, OracleTraceFuncName.Close, ex3.ToString());
				}
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleConnection, OracleTraceFuncName.Close, "(conid=" + m_id + ") (state=" + m_connectionState.ToString() + ") (sessid=" + m_sessionId + ") (implid=" + m_implId + ") (pooling=" + ((m_cs != null && m_cs.m_pooling) ? "T" : "F") + ") " + Trace.GetCPInfo(m_oracleConnectionImpl, null, null, null));
				}
				ResetAllCriteria();
			}
		}

		public new OracleCommand CreateCommand()
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleConnection, OracleTraceFuncName.CreateCommand);
			}
			OracleCommand oracleCommand = null;
			try
			{
				return new OracleCommand("", this);
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleConnection, OracleTraceFuncName.CreateCommand, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleConnection, OracleTraceFuncName.CreateCommand);
				}
			}
		}

		public object Clone()
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleConnection, OracleTraceFuncName.Clone);
			}
			OracleConnection oracleConnection = null;
			try
			{
				oracleConnection = (OracleConnection)MemberwiseClone();
				oracleConnection.m_oracleConnectionImpl = null;
				oracleConnection.m_connectionState = ConnectionState.Closed;
				oracleConnection.m_pwdValidated = false;
				oracleConnection.m_stateChangeEventHandler = null;
				oracleConnection.m_infoMessageEventHandler = null;
				oracleConnection.m_disposed = false;
				return oracleConnection;
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleConnection, OracleTraceFuncName.Clone, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleConnection, OracleTraceFuncName.Clone);
				}
			}
		}

		public OracleGlobalization GetSessionInfo()
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleConnection, OracleTraceFuncName.GetSessionInfo);
			}
			try
			{
				if (m_connectionState == ConnectionState.Closed)
				{
					throw new InvalidOperationException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.CON_CLOSED));
				}
				bool isDB12101nAbove = ((m_majorVersion >= 12) ? true : false);
				if (m_oracleConnectionImpl.m_oracleGlobalizationImpl == null)
				{
					m_oracleConnectionImpl.m_oracleGlobalizationImpl = new OracleGlobalizationImpl();
				}
				if (m_oracleConnectionImpl.m_sessionProperties != null)
				{
					m_oracleConnectionImpl.GetGlobalizationValues(m_oracleConnectionImpl.m_oracleGlobalizationImpl, this, isDB12101nAbove);
				}
				else
				{
					m_oracleConnectionImpl.m_oracleGlobalizationImpl.AlterSession(m_oracleConnectionImpl.m_oracleGlobalizationImpl, this);
				}
				return new OracleGlobalization((OracleGlobalizationImpl)m_oracleConnectionImpl.m_oracleGlobalizationImpl.Clone());
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleConnection, OracleTraceFuncName.GetSessionInfo, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleConnection, OracleTraceFuncName.GetSessionInfo);
				}
			}
		}

		public void GetSessionInfo(OracleGlobalization oraGlob)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleConnection, OracleTraceFuncName.GetSessionInfo);
			}
			try
			{
				if (m_connectionState == ConnectionState.Closed)
				{
					throw new InvalidOperationException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.CON_CLOSED));
				}
				bool isDB12101nAbove = ((m_majorVersion >= 12) ? true : false);
				if (m_oracleConnectionImpl.m_oracleGlobalizationImpl == null)
				{
					m_oracleConnectionImpl.m_oracleGlobalizationImpl = new OracleGlobalizationImpl();
				}
				if (m_oracleConnectionImpl.m_sessionProperties != null)
				{
					m_oracleConnectionImpl.GetGlobalizationValues(m_oracleConnectionImpl.m_oracleGlobalizationImpl, this, isDB12101nAbove);
				}
				else
				{
					m_oracleConnectionImpl.m_oracleGlobalizationImpl.AlterSession(m_oracleConnectionImpl.m_oracleGlobalizationImpl, this);
				}
				oraGlob.m_oracleGlobalizationImpl.RefreshFrom(m_oracleConnectionImpl.m_oracleGlobalizationImpl);
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleConnection, OracleTraceFuncName.GetSessionInfo, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleConnection, OracleTraceFuncName.GetSessionInfo);
				}
			}
		}

		public void SetSessionInfo(OracleGlobalization oraGlob)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleConnection, OracleTraceFuncName.SetSessionInfo);
			}
			try
			{
				if (m_connectionState == ConnectionState.Closed)
				{
					throw new InvalidOperationException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.CON_CLOSED));
				}
				if (oraGlob != null)
				{
					bool isDB12101nAbove = ((m_majorVersion >= 12) ? true : false);
					if (m_oracleConnectionImpl.m_oracleGlobalizationImpl == null)
					{
						m_oracleConnectionImpl.m_oracleGlobalizationImpl = new OracleGlobalizationImpl();
					}
					if (m_oracleConnectionImpl.m_sessionProperties != null)
					{
						m_oracleConnectionImpl.GetGlobalizationValues(m_oracleConnectionImpl.m_oracleGlobalizationImpl, this, isDB12101nAbove);
					}
					else
					{
						m_oracleConnectionImpl.m_oracleGlobalizationImpl.AlterSession(m_oracleConnectionImpl.m_oracleGlobalizationImpl, this);
					}
					m_oracleConnectionImpl.m_oracleGlobalizationImpl.AlterSession(oraGlob.m_oracleGlobalizationImpl, this);
				}
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleConnection, OracleTraceFuncName.SetSessionInfo, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleConnection, OracleTraceFuncName.SetSessionInfo);
				}
			}
		}

		public void PurgeStatementCache()
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleConnection, OracleTraceFuncName.PurgeStatementCache);
			}
			try
			{
				if (m_oracleConnectionImpl != null && m_oracleConnectionImpl.m_statementCache != null)
				{
					m_oracleConnectionImpl.PurgeStatementCache();
				}
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleConnection, OracleTraceFuncName.PurgeStatementCache, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleConnection, OracleTraceFuncName.PurgeStatementCache);
				}
			}
		}

		public override DataTable GetSchema()
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleConnection, OracleTraceFuncName.GetSchema);
			}
			DataTable dataTable = null;
			try
			{
				return GetSchema(DbMetaDataCollectionNames.MetaDataCollections, null);
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleConnection, OracleTraceFuncName.GetSchema, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleConnection, OracleTraceFuncName.GetSchema);
				}
			}
		}

		public override DataTable GetSchema(string collectionName)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleConnection, OracleTraceFuncName.GetSchema);
			}
			DataTable dataTable = null;
			try
			{
				return GetSchema(collectionName, null);
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleConnection, OracleTraceFuncName.GetSchema, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleConnection, OracleTraceFuncName.GetSchema);
				}
			}
		}

		public override DataTable GetSchema(string collectionName, string[] restrictionsArray)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleConnection, OracleTraceFuncName.GetSchema);
			}
			DataTable dataTable = null;
			try
			{
				if (collectionName == null || collectionName.Length == 0)
				{
					throw new ArgumentException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.CON_GS_COLL_NOT_DEFINED, collectionName));
				}
				if (m_connectionState == ConnectionState.Closed)
				{
					throw new InvalidOperationException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.CON_CLOSED));
				}
				if (m_metaDataCollectionDS == null)
				{
					LoadMetaDataXmlDS();
				}
				if (m_metaDataCollectionDS != null)
				{
					dataTable = new DataTable();
					string text = NormalizeDBVersion(m_serverVersion);
					string text2 = collectionName.ToUpperInvariant();
					int num = 0;
					if (restrictionsArray != null)
					{
						num = restrictionsArray.Length;
					}
					switch (text2)
					{
					case "METADATACOLLECTIONS":
						if (num > 0)
						{
							throw new InvalidOperationException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.CON_GS_MORE_RESTRICTIONS, collectionName, "0"));
						}
						PopulateSupportedDataRows(dataTable, collectionName, text);
						dataTable.TableName = DbMetaDataCollectionNames.MetaDataCollections;
						dataTable.AcceptChanges();
						return dataTable;
					case "DATATYPES":
						if (num > 0)
						{
							throw new InvalidOperationException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.CON_GS_MORE_RESTRICTIONS, collectionName, "0"));
						}
						PopulateSupportedDataRows(dataTable, collectionName, text);
						dataTable.TableName = DbMetaDataCollectionNames.DataTypes;
						dataTable.AcceptChanges();
						return dataTable;
					case "RESTRICTIONS":
						if (num > 0)
						{
							throw new InvalidOperationException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.CON_GS_MORE_RESTRICTIONS, collectionName, "0"));
						}
						PopulateSupportedDataRows(dataTable, collectionName, text);
						dataTable.TableName = DbMetaDataCollectionNames.Restrictions;
						dataTable.AcceptChanges();
						return dataTable;
					case "RESERVEDWORDS":
						if (num > 0)
						{
							throw new InvalidOperationException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.CON_GS_MORE_RESTRICTIONS, collectionName, "0"));
						}
						PopulateSupportedDataRows(dataTable, collectionName, text);
						dataTable.TableName = DbMetaDataCollectionNames.ReservedWords;
						dataTable.AcceptChanges();
						return dataTable;
					case "DATASOURCEINFORMATION":
						if (num > 0)
						{
							throw new InvalidOperationException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.CON_GS_MORE_RESTRICTIONS, collectionName, "0"));
						}
						dataTable = m_metaDataCollectionDS.Tables[collectionName].Copy();
						dataTable.Rows[0][DbMetaDataColumnNames.DataSourceProductVersion] = m_serverVersion;
						dataTable.Rows[0][DbMetaDataColumnNames.DataSourceProductVersionNormalized] = text;
						dataTable.TableName = DbMetaDataCollectionNames.DataSourceInformation;
						dataTable.AcceptChanges();
						return dataTable;
					default:
					{
						string text3 = null;
						int num2 = 0;
						string text4 = null;
						bool flag = false;
						bool flag2 = false;
						DataRowCollection rows = m_metaDataCollectionDS.Tables[DbMetaDataCollectionNames.MetaDataCollections].Rows;
						for (int i = 0; i < rows.Count; i++)
						{
							if (((string)rows[i][DbMetaDataColumnNames.CollectionName]).ToUpperInvariant() == text2 && ((string)rows[i]["PopulationMechanism"]).ToUpperInvariant() == "ORACLECOMMAND")
							{
								flag2 = true;
								if (text4 == null)
								{
									text4 = (string)rows[i][DbMetaDataColumnNames.CollectionName];
								}
								if (SupportedInCurrentVersion(rows[i], text))
								{
									num2 = (int)rows[i][DbMetaDataColumnNames.NumberOfRestrictions];
									text3 = (string)rows[i]["PopulationString"];
									flag = false;
									break;
								}
								flag = true;
							}
							else if (((string)rows[i][DbMetaDataColumnNames.CollectionName]).ToUpperInvariant() == text2 && ((string)rows[i]["PopulationMechanism"]).ToUpperInvariant() == "DATATABLE")
							{
								dataTable = m_metaDataCollectionDS.Tables[collectionName].Copy();
								dataTable.TableName = collectionName.ToString();
								dataTable.AcceptChanges();
								return dataTable;
							}
						}
						if (!flag2)
						{
							throw new ArgumentException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.CON_GS_COLL_NOT_DEFINED, collectionName));
						}
						if (flag)
						{
							throw new InvalidOperationException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.CON_GS_COLL_NOT_SUPPORTED, collectionName));
						}
						if (num > num2)
						{
							throw new InvalidOperationException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.CON_GS_MORE_RESTRICTIONS, collectionName, num2.ToString()));
						}
						_ = new string[num2];
						DataRowCollection rows2 = m_metaDataCollectionDS.Tables[DbMetaDataCollectionNames.Restrictions].Rows;
						int num3 = 0;
						ArrayList arrayList = new ArrayList();
						for (int j = 0; j < rows2.Count; j++)
						{
							if (!(((string)rows2[j][DbMetaDataColumnNames.CollectionName]).ToUpperInvariant() == text2))
							{
								continue;
							}
							OracleParameter oracleParameter = new OracleParameter();
							OracleParameter oracleParameter2 = new OracleParameter();
							if (restrictionsArray != null)
							{
								if (num3 >= restrictionsArray.Length)
								{
									oracleParameter.Value = null;
									oracleParameter2.Value = null;
								}
								else
								{
									oracleParameter.Value = restrictionsArray[num3];
									oracleParameter2.Value = restrictionsArray[num3];
								}
							}
							else
							{
								oracleParameter.Value = null;
								oracleParameter2.Value = null;
							}
							oracleParameter.ParameterName = (string)rows2[j]["ParameterName"];
							oracleParameter2.ParameterName = (string)rows2[j]["ParameterName"];
							arrayList.Add(oracleParameter);
							arrayList.Add(oracleParameter2);
							num3++;
							if (num3 >= num2)
							{
								break;
							}
						}
						if (text3 != null)
						{
							OracleDataAdapter oracleDataAdapter = new OracleDataAdapter(text3, this);
							oracleDataAdapter.SelectCommand.InitialLONGFetchSize = -1;
							foreach (OracleParameter item in arrayList)
							{
								oracleDataAdapter.SelectCommand.Parameters.Add(item);
							}
							try
							{
								oracleDataAdapter.Fill(dataTable);
							}
							catch (Exception innerException)
							{
								throw new InvalidOperationException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.CON_GS_QUERY_FAILED, collectionName), innerException);
							}
							if (text4 != null)
							{
								dataTable.TableName = text4;
							}
							dataTable.AcceptChanges();
							foreach (OracleParameter item2 in arrayList)
							{
								item2.Dispose();
							}
							arrayList.Clear();
							arrayList = null;
							oracleDataAdapter.Dispose();
							oracleDataAdapter = null;
							return dataTable;
						}
						throw new InvalidOperationException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.CON_GS_NO_POPULATION_STRING, collectionName));
					}
					}
				}
				throw new InvalidOperationException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.CON_GS_NO_METADATA_STREAM, collectionName));
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleConnection, OracleTraceFuncName.GetSchema, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleConnection, OracleTraceFuncName.GetSchema);
				}
			}
		}

		public override void EnlistTransaction(Transaction transaction)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleConnection, OracleTraceFuncName.EnlistTransaction, "(conid=" + m_id + ") (state=" + m_connectionState.ToString() + ") (sessid=" + m_sessionId + ") (implid=" + m_implId + ") (pooling=" + ((m_cs != null && m_cs.m_pooling) ? "T" : "F") + ") " + Trace.GetCPInfo(m_oracleConnectionImpl, null, null, null));
			}
			try
			{
				if (m_connectionState == ConnectionState.Closed)
				{
					throw new InvalidOperationException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.CON_CLOSED));
				}
				if (m_oraTransaction != null && !m_oraTransaction.Completed)
				{
					throw new InvalidOperationException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.CON_ALREADY_TXNED));
				}
				if (m_oracleConnectionImpl.m_mtsTxnCtx != null && m_oracleConnectionImpl.m_mtsTxnCtx.m_txnType != 0)
				{
					if (string.Compare(m_oracleConnectionImpl.m_mtsTxnCtx.m_txnLocalID, transaction.TransactionInformation.LocalIdentifier, ignoreCase: true) != 0)
					{
						throw new InvalidOperationException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.CON_ALREADY_TXNED));
					}
					m_oracleConnectionImpl.m_lastEnlistedTransaction = transaction;
					if (ProviderConfig.m_bTraceLevelPrivate)
					{
						Trace.Write(OracleTraceLevel.Private, OracleTraceTag.MTS, OracleTraceClassName.OracleConnection, OracleTraceFuncName.EnlistTransaction, "Connection with Conn ID = " + m_oracleConnectionImpl.m_endUserSessionId + " is already enlisted");
					}
				}
				else if (!(transaction == null))
				{
					m_oracleConnectionImpl.m_pm.ProcessCriteriaCtx_EnlistedConnection(this);
					MTSRMManager.CCPEnlistTransaction(m_oracleConnectionImpl, transaction, this);
					m_oracleConnectionImpl.m_lastEnlistedTransaction = transaction;
					m_oracleConnectionImpl.m_bDynamicallyEnlisted = true;
				}
			}
			catch
			{
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleConnection, OracleTraceFuncName.EnlistTransaction, "(conid=" + m_id + ") (state=" + m_connectionState.ToString() + ") (sessid=" + m_sessionId + ") (implid=" + m_implId + ") (pooling=" + ((m_cs != null && m_cs.m_pooling) ? "T" : "F") + ") " + Trace.GetCPInfo(m_oracleConnectionImpl, null, null, null, bResourcePoolInfo: true));
				}
			}
		}

		public static void ClearAllPools()
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleConnection, OracleTraceFuncName.ClearAllPools);
			}
			try
			{
				OracleConnectionDispenser<OraclePoolManager, OraclePool, OracleConnectionImpl>.ClearAllPools();
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleConnection, OracleTraceFuncName.ClearAllPools, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleConnection, OracleTraceFuncName.ClearAllPools);
				}
			}
		}

		public static void ClearPool(OracleConnection conn)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleConnection, OracleTraceFuncName.ClearPool);
			}
			try
			{
				if (conn != null && conn.m_cs != null && !string.IsNullOrEmpty(conn.m_cs.m_pmId))
				{
					OracleConnectionDispenser<OraclePoolManager, OraclePool, OracleConnectionImpl>.ClearPool(conn.m_cs);
				}
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleConnection, OracleTraceFuncName.ClearPool, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleConnection, OracleTraceFuncName.ClearPool);
				}
			}
		}

		public void SetShardingKey(OracleShardingKey shardingKey)
		{
			SetShardingKey(shardingKey, null);
		}

		public void SetShardingKey(OracleShardingKey shardingKey, OracleShardingKey superShardingKey)
		{
			if (m_connectionState != 0)
			{
				throw new InvalidOperationException();
			}
			if (shardingKey != null)
			{
				shardingKey.Build();
				string text = shardingKey.EncodeKeyinB64Format();
				if (text != null)
				{
					m_shardKey = shardingKey;
					m_ShardingKeyB64 = text;
				}
			}
			if (superShardingKey != null)
			{
				superShardingKey.IsSuperShardingKey = true;
				superShardingKey.Build();
				string text2 = superShardingKey.EncodeKeyinB64Format();
				if (text2 != null)
				{
					m_shardGroupKey = superShardingKey;
					m_SuperShardingKeyB64 = text2;
				}
			}
		}

		protected override DbTransaction BeginDbTransaction(System.Data.IsolationLevel isolationLevel)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleConnection, OracleTraceFuncName.BeginDbTransaction);
			}
			DbTransaction dbTransaction = null;
			try
			{
				if (System.Data.IsolationLevel.Unspecified == isolationLevel)
				{
					isolationLevel = System.Data.IsolationLevel.ReadCommitted;
				}
				return BeginTransaction(isolationLevel);
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleConnection, OracleTraceFuncName.BeginDbTransaction, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleConnection, OracleTraceFuncName.BeginDbTransaction);
				}
			}
		}

		protected override void Dispose(bool disposing)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleConnection, OracleTraceFuncName.Dispose);
			}
			m_disposed = true;
			m_dataSource = string.Empty;
			m_serverVersion = string.Empty;
			m_serviceName = string.Empty;
			m_pdbName = string.Empty;
			m_appEdition = string.Empty;
			m_userProvidedConEditionName = string.Empty;
			try
			{
				bool flag = m_connectionState == ConnectionState.Closed && m_oracleConnectionImpl == null;
				try
				{
					if (!disposing && !flag && OraclePool.m_bPerfNumberOfReclaimedConnections)
					{
						OraclePool.PerformanceCounterIncrement(OraclePerfParams.CounterIndex.NumberOfReclaimedConnections, m_oracleConnectionImpl, m_oracleConnectionImpl.m_cp);
					}
				}
				catch (Exception ex)
				{
					if (ProviderConfig.m_bTraceLevelPublic)
					{
						Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleConnection, OracleTraceFuncName.Dispose, ex.ToString());
					}
				}
				if (!flag)
				{
					try
					{
						Close();
					}
					catch (Exception ex2)
					{
						if (ProviderConfig.m_bTraceLevelPublic)
						{
							Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleConnection, OracleTraceFuncName.Dispose, ex2.ToString());
						}
					}
				}
				try
				{
					base.Dispose(disposing);
				}
				catch (Exception ex3)
				{
					if (ProviderConfig.m_bTraceLevelPublic)
					{
						Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleConnection, OracleTraceFuncName.Dispose, ex3.ToString());
					}
				}
				try
				{
					GC.SuppressFinalize(this);
				}
				catch (Exception ex4)
				{
					if (ProviderConfig.m_bTraceLevelPublic)
					{
						Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleConnection, OracleTraceFuncName.Dispose, ex4.ToString());
					}
				}
			}
			catch (Exception ex5)
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleConnection, OracleTraceFuncName.Dispose, ex5.ToString());
				}
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleConnection, OracleTraceFuncName.Dispose);
				}
			}
		}

		protected override DbCommand CreateDbCommand()
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Entry, OracleTraceClassName.OracleConnection, OracleTraceFuncName.CreateDbCommand);
			}
			DbCommand dbCommand = null;
			try
			{
				return new OracleCommand("", this);
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, OracleTraceTag.Error, OracleTraceClassName.OracleConnection, OracleTraceFuncName.CreateDbCommand, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Exit, OracleTraceClassName.OracleConnection, OracleTraceFuncName.CreateDbCommand);
				}
			}
		}

		protected override void OnStateChange(StateChangeEventArgs eventArgs)
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Entry, OracleTraceClassName.OracleConnection, OracleTraceFuncName.OnStateChange);
			}
			try
			{
				if (m_stateChangeEventHandler != null)
				{
					m_stateChangeEventHandler(this, eventArgs);
				}
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, OracleTraceTag.Error, OracleTraceClassName.OracleConnection, OracleTraceFuncName.OnStateChange, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Exit, OracleTraceClassName.OracleConnection, OracleTraceFuncName.OnStateChange);
				}
			}
		}

		internal void OnConnectionOpen(OracleConnectionOpenEventArgs eventArgs)
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Entry, OracleTraceClassName.OracleConnection, OracleTraceFuncName.OnConnectionOpen);
			}
			try
			{
				if (m_conOpenEventHandler != null)
				{
					m_conOpenEventHandler(eventArgs);
				}
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, OracleTraceTag.Error, OracleTraceClassName.OracleConnection, OracleTraceFuncName.OnConnectionOpen, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Exit, OracleTraceClassName.OracleConnection, OracleTraceFuncName.OnConnectionOpen);
				}
			}
		}

		internal static void OnHAEvent(object state)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Entry, OracleTraceClassName.OracleConnection, OracleTraceFuncName.OnHAEvent);
			}
			try
			{
				OracleHAEventArgs eventArgs = (OracleHAEventArgs)state;
				if (m_haEventHandler != null)
				{
					m_haEventHandler(eventArgs);
				}
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, OracleTraceTag.Error, OracleTraceClassName.OracleConnection, OracleTraceFuncName.OnHAEvent, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Exit, OracleTraceClassName.OracleConnection, OracleTraceFuncName.OnHAEvent);
				}
			}
		}

		private void PopulateSupportedDataRows(DataTable dt, string collectionName, string normalizedDBVersion)
		{
			int count = m_metaDataCollectionDS.Tables[collectionName].Columns.Count;
			for (int i = 0; i < count; i++)
			{
				DataColumn dataColumn = new DataColumn();
				dataColumn.ColumnName = m_metaDataCollectionDS.Tables[collectionName].Columns[i].ColumnName;
				dataColumn.DataType = m_metaDataCollectionDS.Tables[collectionName].Columns[i].DataType;
				dt.Columns.Add(dataColumn);
			}
			foreach (DataRow row in m_metaDataCollectionDS.Tables[collectionName].Rows)
			{
				if (SupportedInCurrentVersion(row, normalizedDBVersion))
				{
					DataRow dataRow2 = dt.NewRow();
					for (int j = 0; j < count; j++)
					{
						dataRow2[j] = row[j];
					}
					dt.Rows.Add(dataRow2);
				}
			}
			dt.Columns.Remove("MaximumVersion");
			dt.Columns.Remove("MinimumVersion");
		}

		private void LoadMetaDataXmlDS()
		{
			Stream stream = null;
			if (stream == null)
			{
				stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Oracle.ManagedDataAccess.src.Client.Resources.OracleMetadata.xml");
			}
			if (stream != null)
			{
				XmlTextReader xmlTextReader = new XmlTextReader(stream);
				m_metaDataCollectionDS = new DataSet("DocumentElement");
				m_metaDataCollectionDS.ReadXml(xmlTextReader);
				xmlTextReader.Close();
			}
		}

		private string NormalizeDBVersion(string str)
		{
			string text = null;
			int num = 0;
			int num2 = 0;
			int length = str.Length;
			while (num <= length && num2 > -1)
			{
				num2 = str.IndexOf(".", num);
				if (num2 == -1)
				{
					if (length - num == 1)
					{
						text += "0";
					}
					text += str.Substring(num, length - num);
					break;
				}
				if (num2 - num == 1)
				{
					text += "0";
				}
				text += str.Substring(num, num2 - num + 1);
				num = num2 + 1;
			}
			return text;
		}

		private bool SupportedInCurrentVersion(DataRow row, string normalizedDBVersion)
		{
			string xmlnormalizedDBVersion = row["MaximumVersion"].ToString();
			string xmlnormalizedDBVersion2 = row["MinimumVersion"].ToString();
			if (ComparenormalizedDBVersions(normalizedDBVersion, xmlnormalizedDBVersion2) >= 0 && ComparenormalizedDBVersions(normalizedDBVersion, xmlnormalizedDBVersion) <= 0)
			{
				return true;
			}
			return false;
		}

		private int ComparenormalizedDBVersions(string normalizedDBVersion, string xmlnormalizedDBVersion)
		{
			int result = 0;
			int i = 0;
			int length = normalizedDBVersion.Length;
			NumberFormatInfo numberFormatInfo = new NumberFormatInfo();
			numberFormatInfo.NumberDecimalSeparator = ".";
			if (xmlnormalizedDBVersion.Length > 0)
			{
				for (; i <= length; i += 3)
				{
					if (int.Parse(normalizedDBVersion.Substring(i, 2), numberFormatInfo) > int.Parse(xmlnormalizedDBVersion.Substring(i, 2), numberFormatInfo))
					{
						return result = 1;
					}
					if (int.Parse(normalizedDBVersion.Substring(i, 2), numberFormatInfo) < int.Parse(xmlnormalizedDBVersion.Substring(i, 2), numberFormatInfo))
					{
						return result = -1;
					}
				}
			}
			return result;
		}

		internal OracleTransaction GetTransaction()
		{
			if (m_oraTransaction != null && m_oraTransaction.Completed)
			{
				m_oraTransaction = null;
			}
			return m_oraTransaction;
		}

		internal void InitializeOrclPermission(string connString)
		{
		}

		internal void RaiseStateChange(ConnectionState originalState, ConnectionState currentState)
		{
			StateChangeEventArgs stateChange = new StateChangeEventArgs(originalState, currentState);
			OnStateChange(stateChange);
		}

		internal void OnInfoMessage(object obj, int errCode, string warningMsg)
		{
			if (m_infoMessageEventHandler != null)
			{
				OracleError value = new OracleError(errCode, DataSource, string.Empty, warningMsg);
				OracleErrorCollection oracleErrorCollection = new OracleErrorCollection();
				oracleErrorCollection.Add(value);
				try
				{
					m_infoMessageEventHandler(obj, new OracleInfoMessageEventArgs(oracleErrorCollection));
				}
				catch
				{
				}
			}
		}

		internal void CheckForWarnings(object source)
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Entry, OracleTraceClassName.OracleConnection, OracleTraceFuncName.CheckForWarnings);
			}
			try
			{
				if (m_infoMessageEventHandler != null)
				{
					OracleConnectionImpl oracleConnectionImpl = ((m_oracleConnectionImpl != null) ? m_oracleConnectionImpl : (source as OracleConnectionImpl));
					if (oracleConnectionImpl != null && oracleConnectionImpl.GetLastWarning(out var warningMsg, out var errorCode))
					{
						OnInfoMessage(source, errorCode, warningMsg);
					}
				}
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, OracleTraceTag.Error, OracleTraceClassName.OracleConnection, OracleTraceFuncName.CheckForWarnings, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Exit, OracleTraceClassName.OracleConnection, OracleTraceFuncName.CheckForWarnings);
				}
			}
		}
	}
}
